import axios, { AxiosInstance } from "axios";
import store from "@/store";

// eslint-disable-next-line

// 创建axios实例
const service: AxiosInstance = axios.create({
    baseURL: "",
    timeout: 5000,
    // withCredentials: true
});

// 请求拦截器
service.interceptors.request.use(
    (config) => {
        if (store.getters.getToken) {
        }
        return config;
    },
    (error) => {
        return Promise.reject(error);
    }
);

// 响应拦截器
service.interceptors.response.use(
    (response): any => {
        return response.data;
    },
    (error) => {
        return Promise.reject(error);
    }
);

export default service;
